﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace CoreLib.Input
{
  public  class KeyBoard:CBaseComponent
    {
      public KeyBoard(Game game)
          : base(game)
      {
      }
        private static KeyboardState keyBoardState;

        public static KeyboardState KeyBoardState
        {
            get { return keyBoardState; }
            set { keyBoardState = value; }
        }
        public static bool IsKeyDown(Keys key)
        {
            keyBoardState = Keyboard.GetState();
            Keys[] keys = keyBoardState.GetPressedKeys();
            if (keys.Length == 0)
                return false;
            if (keys[0] == key)
                return true;
            return false;
        }
    }
}
